<template>
	<view class="content">
		<view v-if="isShowConfirm" class="dialog" @click="isShowConfirm = false">
			<view class="dialog-content">
				<view class="dialog-content-image"><image src="../../static/confirm.png" mode="widthFix"></image></view>
				<view class="dialog-content-title">恭喜您预约成功</view>
			</view>
		</view>

		<image src="../../static/images/index/banner1.png" mode="widthFix"></image>
		<view class="from-item">
			<view class="from-item-name">楼盘名称</view>
			<view class="from-item-input"><input placeholder="请输入楼盘名称" /></view>
		</view>
		<view class="from-item">
			<view class="from-item-name">预约类型</view>
			<view class="from-item-input">
				<picker mode="selector" :range="array" :index="index" @change="bindPickerChange">
					<view>{{ array[index] }}</view>
				</picker>
				<image class="from-more" src="../../static/more.png" mode="widthFix"></image>
			</view>
		</view>
		<view class="from-item">
			<view class="from-item-name">户&emsp;&emsp;型</view>
			<view class="from-item-input unit-input">
				<input placeholder="请输入户型" type="number" />
				<view class="from-unit"><view>(m²)</view></view>
			</view>
		</view>
		<view class="from-item">
			<view class="from-item-name">姓&emsp;&emsp;名</view>
			<view class="from-item-input"><input placeholder="请输入姓名" /></view>
		</view>
		<view class="from-item">
			<view class="from-item-name">联系方式</view>
			<view class="from-item-input"><input placeholder="请输入联系方式" /></view>
		</view>
		<view class="from-item">
			<view class="from-item-name">微信号码</view>
			<view class="from-item-input"><input placeholder="请输入微信号码" /></view>
		</view>
		<view class="btn" hover-class="btn-hover" type="default" size="mini" @click="isShowConfirm = true">确定预约</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			isShowConfirm: false,
			index: 0,
			array: ['验房', '微改报价', '设计', '拎包入住']
		};
	},
	methods: {
		bindPickerChange(e) {
			this.index = e.detail.value;
		}
	}
};
</script>

<style lang="less" scoped>
.content {
	display: flex;
	flex-direction: column;

	.dialog {
		position: fixed;
		width: 100%;
		height: 100vh;
		background: rgba(0, 0, 0, 0.5);
		z-index: 999;

		.dialog-content {
			position: absolute;
			left: 0;
			top: 0;
			right: 0;
			bottom: 0;
			width: 300rpx;
			height: 228rpx;
			margin: auto;
			background: #ffffff;
			border-radius: 16rpx;
			display: flex;
			align-items: center;
			flex-direction: column;

			.dialog-content-image {
				width: 136rpx;
				height: 136rpx;
				margin-top: 20rpx;
			}
			.dialog-content-title {
				font-size: 28rpx;
			}
		}
	}

	.from-item {
		display: flex;
		align-items: center;
		box-sizing: border-box;
		margin-top: 40rpx;

		.from-item-name {
			margin: auto 40rpx;
			font-size: 28rpx;
		}

		.from-item-input {
			position: relative;
			flex: 1;
			height: 60rpx;
			background-color: white;
			margin-right: 72rpx;
			border: 2rpx solid rgba(0, 0, 0, 0.1);
			border-radius: 8rpx;
			padding-left: 24rpx;
			padding-right: 24rpx;

			* {
				height: 100%;
				line-height: 60rpx;
				font-size: 24rpx;
			}

			.from-more {
				position: absolute;
				bottom: 0;
				top: 0;
				right: 20rpx;
				height: 20rpx;
				width: 20rpx;
				margin: auto;
			}

			.from-unit {
				position: absolute;
				bottom: 0;
				top: 0;
				right: 20rpx;
				color: #999999;
			}
		}
		.unit-input {
			padding-right: 96rpx;
		}
	}
}
</style>
